<% if @users.length == 0 then %>
  <p>Não existe nenhum usuário cadastrado.</p>
<% else %>
  <table border="1">
  <thead>
      <tr>
          <td>Nome</td>
          <td>E-mail</td>
          <td>Status</td>
          <td>&nbsp;</td>
      </tr>
  </thead>
  <tbody>
      <% for user in @users %>
      <tr onmouseover="this.style.background='#DFDFFF'" onmouseout="this.style.background=''">
          <td><%=user[:name]%></td>
          <td><%=user[:email]%></td>
          <% if user[:status] then%>
          <td>Ativo</td>
          <% else %>
          <td>Desativado</td>
          <% end %>
          <td style="width:75px">
              <%=link_to_remote( 
                        image_tag("/images/icons/alter.gif", :title => "alterar", :border => "0" ) , 
                        :url => { :action => "user_form", :id => user[:id], :act => "user_alter" }, 
                        :loading => "TrackSuite.ajax.loadding('user_list_action_#{user[:name]}');",
                        :loaded => "TrackSuite.ajax.loaded.clear('user_list_action_#{user[:name]}');"
              )%>
              <%=link_to_remote( 
                        image_tag("/images/icons/lock.gif", :title => "alterar senha", :border => "0" ) , 
                        :url => { :action => "user_form", :id => user[:id], :act => "user_alter", :alterpass => true }, 
                        :loading => "TrackSuite.ajax.loadding('user_list_action_#{user[:name]}');",
                        :loaded => "TrackSuite.ajax.loaded.clear('user_list_action_#{user[:name]}');"                      
              )%>
              <%=link_to_remote( 
                        image_tag("/images/icons/remove.gif", :title => "remover", :border => "0" ) , 
                        :url => { :action => "user_remove", :id => user[:id] }, 
                        :loading => "TrackSuite.ajax.loadding('user_list_action_#{user[:name]}');",
                        :loaded => "TrackSuite.ajax.loaded.clear('user_list_action_#{user[:name]}');",
                        :confirm => "Atenção, deseja remover o usuário #{user[:name]}."
              )%>
              <span id="user_list_action_<%=user[:name]%>">&nbsp;</span>
          </td>
      </tr>
      <% end %>
  </tbody>
  <tfoot>
      <tr>
          <td colspan="4" align="right">&nbsp;<%= will_paginate @users, {:ajax => ajax} %></td>
      </tr>
  </tfoot>
  </table>
<% end %>